﻿function isNumber(key) {
    return (key >= 48 && key <= 57) || (key >= 96 && key <= 105);
}

function isSpecialKey(key) {
    return key == 8 || key == 46 || (key >= 37 && key <= 40) || key == 35 || key == 36 || key == 9 || key == 13;
}

function isFullStop(key) {
    return key == 190 || key == 110;
}


//过滤特殊字符
function checkSpecialChar(s) {
    var char = new Array('*', '-', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '"', ';', ':', '<', '/>');
    for (var i = 0; i < char.length; i++) {
        if (s.indexOf(char[i]) > -1) {
            return true;
        }
    }
    return false;
}

// 获取字符串的长度 一个汉字为2个字符 
function getTextLength(str) {
    return str.replace(/[^\x00-\xff]/g, "xx").length;
};

//QQ验证
function check_QQ(str) {
    var qq = str;
    if (qq != "") {
        if (qq.search(/^[0-9]\d{4,}$/) != -1) {
            redflag = 0;
            return true;
        }
        else {
            redflag = 1;
            return false;
        }
    }
}
//msn验证
function check_msn(str) {
    var msn = str;
    if (msn != "") {
        if (msn.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
            redflag = 0;
            return true;
        }
        else {
            redflag = 1;
            return false;
        }
    }

}